﻿@model S4Store.Models.Decorate.PackageCarSaleDetailModel
 @{
     Layout = null;
     ViewBag.Title = "PackageCarSaleDetail";
}
<div style="height:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)

 <table  style="border-collapse:collapse; width:100%" class="reporttable vmiddle">
 
 <tr>
  <th rowspan="2">车型</th>
  <th rowspan="2">车款</th>
  <th rowspan="2">本月累计交车</th>
  <th colspan="2">上旬套餐版本（1日-10日）</th>
  <th colspan="2">中旬套餐版本（11日-20日）</th>
  <th colspan="2">下旬套餐版本（21日-30日）</th>
  <th rowspan="2">套餐车销售量</th>  
  <th rowspan="2">套餐车销售率</th>
  <th rowspan="2">套餐车销售率差</th>
 </tr>
 <tr>
  <th>是/否</th>
  <th>本月累计</th>
  <th>是/否</th>
  <th>本月累计</th>
  <th>是/否</th>
  <th>本月累计</th>
 </tr>
   @for (var i = 0; i < Model.Reports.Count; i++)
   {
       var report = Model.Reports[i];
 <tr>
    @if (i == 0)
    {
   <td rowspan="@Model.Reports.Count">@Model.CarBrand.Name</td>
    }
    <td>@report.CarModel.Name</td> 
    <td>@report.GiveCarCount</td>  
    <td>@if (report.CarModelMonthConfig.IsLstTenVersion) { <text>是</text>}else{  <text>否</text>}</td> 
    <td>@report.LstTenVersionCount</td> 
    <td>@if (report.CarModelMonthConfig.IsMidTenVersion) { <text>是</text>}else{  <text>否</text>}</td> 
    <td>@report.MidTenVersionCount</td> 
    <td>@if (report.CarModelMonthConfig.IsLastTenVersion) { <text>是</text>}else{  <text>否</text>}</td> 
    <td>@report.LastTenVersionCount</td> 
    <td>@report.PackageCount</td> 
    <td @S4Store.Utils.GetBgColor(report.PackageXSLV >= report.CarKpiMonthConfig.PakeageSaleRateTagrt)>@report.PackageXSLV.toInt()%</td> 
    <td @S4Store.Utils.GetBgColor(report.PackageDiff >= 0)>@report.PackageDiff.toInt()%</td> 
 </tr>
     
   }
   <tr>
    <td colspan="2">@(Model.CarBrand.Name)合计</td>
    <td>@Model.CarBrandReport.GiveCarCount</td>
    <td></td>   
    <td>@Model.CarBrandReport.LstTenVersionCount</td>   
    <td></td>   
    <td>@Model.CarBrandReport.MidTenVersionCount</td>   
    <td></td>   
    <td>@Model.CarBrandReport.LastTenVersionCount</td>   
    <td>@Model.CarBrandReport.PackageCount</td>   
    <td @S4Store.Utils.GetBgColor(Model.CarBrandReport.PackageXSLV>=Model.CarBrandReport.CarKpiMonthConfig.PakeageSaleRateTagrt)>@Model.CarBrandReport.PackageXSLV.toInt()%</td>   
    <td @S4Store.Utils.GetBgColor(Model.CarBrandReport.PackageDiff>=0)>@Model.CarBrandReport.PackageDiff.toInt()%</td>   
   </tr>
 </table>

 <div style=" background-color:#cccccc">
 @{
     foreach(var report in Model.Reports){          
         S4Store.Models.Chart.Pie ChartModel = new S4Store.Models.Chart.Pie();
         ChartModel.Name = report.CarModel.Name;
         ChartModel.Width=370;
         ChartModel.Height=370;
         ChartModel.Unit = "辆";
         ChartModel.YAxis = report.CarModel.Name;
         ChartModel.Data.Add("上旬套餐", report.LstTenVersionCount);
         ChartModel.Data.Add("中旬套餐", report.MidTenVersionCount);
         ChartModel.Data.Add("下旬套餐", report.LastTenVersionCount);
         ChartModel.Data.Add("其他", report.GiveCarCount - (report.LastMonthGiveCar + report.LstTenVersionCount + report.LastMonthGiveCar));
         <div style=" display:inline-block; margin:10px">
         @Html.Partial("../Chart/Pie", ChartModel)
         </div>
     }
 }
 
 </div>
</div>